<me:UIGG x:Class="WPFExcelReport.TGGS08"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                      xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
          xmlns:GC="clr-namespace:WPFExcelReport;assembly=TGSCOLOR" 
                     x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIGG.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby10000  x:Key="dw"/>
        <ucd:TIMES10  x:Key="X10"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:PreisConverter  x:Key="price"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIGG.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" >
            
            <WrapPanel >
                <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsCanNew,ElementName=TV}"
                              >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                    </Button.Background>
                </Button>
                <Button  Click="EditCommand" Width="24" Height="20"
                             IsEnabled="{Binding IsCanChg,ElementName=TV}"
                             >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                    </Button.Background>
                </Button>
                <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanDelete,ElementName=TV}"
                            >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>
                <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24"
                               IsEnabled="{Binding IsCanCopy,ElementName=TV}"
                               >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                    </Button.Background>
                </Button>

                <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24"
                          IsEnabled="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                    </Button.Background>
                </Button>
                <TextBlock Text="{Binding GAGART}"/>
                <TextBlock Text="{Binding GAGVAR}"/>
                <TextBlock Text="{Binding GAGFARBE}"/>
            </WrapPanel> 
            <StackPanel>
                <WrapPanel>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=行}}"/>
                    <TextBlock Text="{Binding GAGPOS}"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=计划}}"/>
                    <ex:TXT72 Text="{Binding GAGDISPOKZ}" MaxLength="1" 
                              IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"/>
                    <WrapPanel Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                        <TextBlock   Text="{Binding Source={Localization:Translate Word=选择纱线}}"/>
                        <GC:TSGS07
                    IsEdit="{Binding IsEdit,ElementName=TV}" 
                    KEY="{Binding YARN,ElementName=TV}"
                              
                />
                    </WrapPanel>
                    <WrapPanel  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                        <TextBlock   Text="{Binding Source={Localization:Translate Word=纱}}"/>
                        <TextBlock Text="{Binding GAGGART}"/>
                        <TextBlock   Text="{Binding Source={Localization:Translate Word=var}}"/>
                        <TextBlock Text="{Binding GAGGVAR}"/>
                        <TextBlock   Text="{Binding Source={Localization:Translate Word=色号}}"/>
                        <TextBlock Text="{Binding GAGGFARBE}"/>
                    </WrapPanel>
                </WrapPanel>
                <WrapPanel>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=损耗}}"/>
                    <ex:NumericBox DecimalPlaces="2" Text="{Binding GAGABF, Converter={StaticResource d100}}"  Width="40"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=比例}}"/>
                    <ex:NumericBox DecimalPlaces="2" Text="{Binding GAGANTEIL, Converter={StaticResource d1000}}" Width="60"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=说明}}"/>
                    <ex:TXT72 Text="{Binding GAGBEM,Converter={StaticResource gb2312}}" MaxLength="20"  Width="100"
                              IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=净重}}"/>
                    <TextBlock   Text="{Binding GAGKGNET,Converter={StaticResource price}}" Width="60"/>
                    <TextBlock   Text="{Binding Source={Localization:Translate Word=总消耗}}"/>
                    <TextBlock   Text="{Binding GAGKGBRUT,Converter={StaticResource price}}" Width="60"/>
                </WrapPanel>
            </StackPanel>
          
        </StackPanel>
        <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                   x:Name="dlgMaster" 
                   RowDetailsVisibilityMode="Visible"  
                >
            <DataGrid.Columns> 
                <DataGridTextColumn Binding="{Binding Path=GAGPOS }" Header="{Binding Source={Localization:Translate Word=行}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGGART, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=纱}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGGVAR, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=var}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGGFARBE, Converter={StaticResource gb2312}}"   Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGABF, Converter={StaticResource d100}}" Header="{Binding Source={Localization:Translate Word=损耗}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGANTEIL, Converter={StaticResource d1000}}" Header="{Binding Source={Localization:Translate Word=比例}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGKGNET, Converter={StaticResource price}}" Header="{Binding Source={Localization:Translate Word=净重}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGKGBRUT, Converter={StaticResource price}}" Header="{Binding Source={Localization:Translate Word=毛重}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGDISPOKZ}" Header="{Binding Source={Localization:Translate Word=计划}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=GAGBEM}" Header="{Binding Source={Localization:Translate Word=备注}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIGG>
